home *** CD-ROM | disk | FTP | other *** search
- Path: risc.sps.mot.com!not-for-mail
- From: moss@risc.sps.mot.com (Matthew Moss)
- Newsgroups: comp.lang.c++
- Subject: Re: Fahrenheight to Celsius?
- Date: 1 Mar 1996 14:01:41 -0600
- Organization: Motorola, Inc. -- Austin,TX
- Message-ID: <4h7l35INN7oe@hood.sps.mot.com>
- References: <4fvthq$2bl@newserv.agcs.com> <1996Feb26.060213.23285@lafn.org> <4h1v08$eks@druid.borland.com> <xmsb.825531341@shadow>
- NNTP-Posting-Host: hood.sps.mot.com
-
- In article <xmsb.825531341@shadow>,
- Maurice S. Barnum <xmsb@shadow.borland.com> wrote:
- >pete@borland.com (Pete Becker) writes:
- >
- >>In article <1996Feb26.060213.23285@lafn.org>, an234@lafn.org says...
- >>>
- >>>F = C*(9/5) +32
- >>>C = (F-32)*(5/9)
- >
- >>He was better off without this answer, which is wrong.
- >
- > my favorite conversion equations, which i learned from
- > reading an article by isaac asimov, is not only simpler,
- > but avoids having to worry as much about the "obvious"
- > problem when written as C++:
- >
- >F = (C + 40) / 1.8 - 40
- >C = (F + 40) * 1.8 - 40
- >
- > for reasons i've never understood, these are not the
- > equations one will find in most books.
- >
- > --xmsb
- > xmsb@borland.com
-
- Ummm.... the first answer is the correct set of equations. The second
- set of equations is nice-looking but WRONG. To prove this point, use
- simple algebra and two well known temperature points, freezing and
- boiling.
-
- freezing (F,C) = ( 32, 0)
- boiling (F,C) = (212, 100)
-
- It's a linear function F = mC + b. Determine the slope m = (F2-F1)/(C2-C1)
- So m = (212-32)/(100-0) = 9/5 = 1.8
-
- So far: F = 1.8C + b
- Plug in (32, 0)
- 32 = 1.8(0) + b
- 32 = 0 + b
- b = 32
-
- So:
- F = (1.8 * C) + 32
- and
- C = (F - 32) / 1.8
-
- These are the same as the first answer. The second answer is *almost*
- correct.... take the two above derived equations and perform some algebra,
- you'll get:
-
- F = (C + 40) * 1.8 - 40
- C = (F + 40) / 1.8 - 40
-
- You got the multiplication and division operations switched. Maybe it was
- a typo in the article.... They look nice, but most things that go into
- the books are usually brought to "simplest terms", not necessary the easiest
- to understand. Simplest terms agrees with the traditional formulas. Even
- the traditional ones would be more efficient on a computer (in a strict
- sense) since it has one less add/substract operation to be done.
- --
- Matthew D Moss RISC Software, Motorola
- moss@risc.sps.mot.com http://www.mot.com/PowerPC/
-